name: Cargo Release

on:
  push:
    branches:
      - main

env:
  CARGO_TERM_COLOR: always
  CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

jobs:
  cargo:
    name: Rust project - latest
    runs-on: ubuntu-latest
    # strategy:
    #   matrix:
    #     toolchain:
    #       - stable
    #       - beta
    #       - nightly
    steps:
      - uses: actions/checkout@v4
      - run: rustup update stable && rustup default stable
      - run: cargo build --release --all-features --verbose
      - run: cargo test --verbose
      # - run: cargo login
      - run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
